css-overview: Fix+Explain color expr number ranges
authorDaniel Boles <dboles@src.gnome.org>
Sat, 18 Mar 2017 01:13:42 +0000 (01:13 +0000)
committerDaniel Boles <dboles@src.gnome.org>
Sat, 18 Mar 2017 01:17:14 +0000 (01:17 +0000)
Last try, promise. They don’t all use 0 to 1. We should probably explain
the effects too. Hopefully this manages that while not being too verbose

docs/reference/gtk/css-overview.xml

index 3a7925e2b5fa2224b83e027a8f7ffbb89408837f..2b5c212eed1a9842b3ec301d471406670e3422b4 100644 (file)
@@ -584,12 +584,16 @@ background-color: @bg_color;
     <para>
       GTK+ also supports color expressions, which allow colors to be transformed
       to new ones and can be nested, providing a rich language to define colors.
+      Color expressions resemble functions, taking 1 or more colors and in some
+      cases a number as arguments.
     </para>
     <para>
-      Color expressions resemble functions, taking 1 or more colors and in some
-      cases a number as their arguments. The number is floating-point, clamped
-      between 0 and 1, and specifies the degree to which the expression will
-      transform the given color(s) in the manner that is indicated by its name.
+      shade() leaves the color unchanged when the number is 1 and transforms it
+      to black or white as the number approaches 0 or 2 respectively. For mix(),
+      0 or 1 return the unaltered 1st or 2nd color respectively; numbers between
+      0 and 1 return blends of the two; and numbers below 0 or above 1 intensify
+      the RGB components of the 1st or 2nd colour respectively. alpha() takes a
+      number from 0 to 1 and applies that as the opacity of the supplied color.
     </para>
 
 <literallayout><code>〈color expression〉 = lighter(〈color〉) | darker(〈color〉) | shade(〈color〉,〈number〉) | alpha(〈color〉,〈number〉) | mix(〈color〉,〈color〉,〈number〉)</code>